<?php
$dir = dirname(dirname(__FILE__));
include_once 'Common.inc.php';

include($dir.'/__queue_global.php');

$host = '10.54.37.212';
$port = '3306';
$user = 'elink';
$pw = 'elink2046';
$name = 'meila';
$table = 'meila_guang_tags';


$sql = 'select `tag_id`,`tag` from `'.$table.'` where `status`= 1';

$conn = mysql_connect($host.':'.$port , $user , $pw, true);
mysql_set_charset('utf-8' , $conn);
$re = mysql_select_db($name , $conn);

if (!$re) {
    echo 'fail'.$table."\r\n";
echo mysql_errno() . ": " . mysql_error() . "\n";
    exit('connect fail');
}
$rs = mysql_query($sql , $conn);
if (!$rs) {
    echo 'fail'.$table."\r\n";

echo mysql_errno() . ": " . mysql_error() . "\n";
    exit('connect query');
}


$row = 1;
while (!empty($row)){
$row = mysql_fetch_array($rs , MYSQL_ASSOC);
$re = ml_tool_sendMq::add_suggest_tag($row['tag'], $row['tag_id']);
if (!re) {
    $error[]= $row['tag_id'];
}
};

$str = json_encode($error);
file_put_contents('error.log', $str);
